package unclassified.simple;

public class LCOF_53II {

    public int missingNumber(int[] nums) {
        int l = 0, r = nums.length - 1;
        while (l <= r) {
            int mid = l + (r - l) / 2;
            if (nums[mid] < mid){
                l = mid + 1;
            } else if (nums[mid] > mid){
                r = mid - 1;
            } else {
                l = mid + 1;
            }
        }
        return r;
    }

    public static void main(String[] args) {
        LCOF_53II ll = new LCOF_53II();
        ll.missingNumber(new int[]{0,1,3});
    }
}
